if (!jsx3.lang.Class.forName("ux.megatron.example.tour.panel.TestPanelPage")) {

jsx3.Class.defineClass(
    "ux.megatron.example.tour.panel.TestPanelPage",
    jsx3.gui.Block,
    null,
    function (objRoot) {

            var commonClickHandler = function() {
                var btnName = this.getName();
                var root = this.getAncestorOfName("blkRoot");
                root.getDescendantOfName("textTip").setText(btnName+ "("+ this.getText() +")" + " is Clicked! Thank you!", true);
                if(btnName == "btnModify") {
                    this.setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                } else if (btnName == "btnCancel") {
                    var btn = this.getAncestorOfName("paneButtons").getDescendantOfName("btnModify");
                    btn.setEnabled(jsx3.gui.Form.STATEENABLED, true);
                }
            }

            var menuSelectHandler = function(msg) {
                var btnMenu = msg.target;
                var textTip = btnMenu.getAncestorOfName("blkRoot").getDescendantOfName("textTip");
                textTip.setText("You choose Menu " + msg.selectedId, true);
            }

            var tabSelected = function(msg) {
                var btnTab = msg.target;
                var textTip = btnTab.getAncestorOfName("blkRoot").getDescendantOfName("textTip");
                textTip.setText("You choose Tab " + btnTab.getText() + "::" + btnTab, true);
            }

            objRoot.prototype.onAfterDeserialize = function() {
                //buttons
                var btnNames = ["btnMenu", "btnSave", "btnModify", "btnCancel", 
                    "btnHelp", "btnPip1", "btnPip2", "btnPip3", "btnRefresh"];
                for(var i=0; i<btnNames.length; i++) {
                    this.getDescendantOfName(btnNames[i]).clickHandler = commonClickHandler;
                }

                this.getDescendantOfName("btnMenu").subscribe(jsx3.gui.Interactive.SELECT, this, menuSelectHandler);

                this.getDescendantOfName("leftSelectPane").subscribe(ux.megatron.gui.LeftSelectPane.BUTTON_SELECTED, this, tabSelected);

                this.getDescendantOfName("tabbedpane").subscribe(ux.megatron.gui.TabbedPane.TAB_SELECTED, this, tabSelected);

            }

    });

};